import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart';

//广告图片
class AdBanner extends StatelessWidget {
  final String advertesPicture;
  final String phoneNumber;

  AdBanner({Key key, this.advertesPicture,this.phoneNumber}) : super(key: key);

  @override
  Widget build(BuildContext context) {


    return Container(
      height: ScreenUtil().setHeight(50),
      width: ScreenUtil().setWidth(1334),
      child:InkWell(
        onTap: _launchURL,
        child: Image.network(advertesPicture,fit: BoxFit.fitWidth,),
      ),

    );
  }
  void _launchURL() async{
    String url='tel:'+ this.phoneNumber;
    if(await canLaunch(url)){
      await launch(url);
    } else {
      throw '不能拨打电话';
    }
  }
}